package com.spzx.channel.service.impl;

import com.spzx.channel.service.BrandService;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.common.core.exception.ServiceException;
import com.spzx.product.api.BrandFeignClient;
import com.spzx.product.api.domain.Brand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName BrandServiceImpl
 * @Author 波
 * @Date 2024/8/5 18:28
 */
@Service
public class BrandServiceImpl implements BrandService {
    @Autowired
    private BrandFeignClient brandFeignClient;
    @Override
    public List<Brand> getBrandAll() {
        R<List<Brand>> brandAll = brandFeignClient.getBrandAll(SecurityConstants.INNER);
        if(R.FAIL==brandAll.getCode()){
            throw new ServiceException(brandAll.getMsg());
        }
        return brandAll.getData();
    }
}
